<!-- 饼图组件 -->

<script setup lang='ts'>
import * as Echarts from "echarts"
import { reactive, onMounted, defineProps } from "vue";
let chart: any
let data = reactive({
    isSeriesEmpty: false
})
const optionProps = defineProps(['option'])
onMounted(function() {
    chart = Echarts.init(document.getElementById('chart'));
    chart.setOption(optionProps.option, true)
    window.addEventListener('resize',() =>{
        chart.resize()
    })
})
</script>
 
<template>
    <h3 v-if="data.isSeriesEmpty">暂无数据</h3>
    <div v-else id="chart">
    </div>
</template>
 
<style scoped>
#chart {
    width: 100%;
    height: 100%;
}
</style>